using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace OnlineGameClient
{
  
    public class GameClient : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        MouseState currentMouseState;
        MouseState previousMouseState;
        Texture2D cursor;
        Texture2D cursorPressed;
        enum GameState 
        {
            Login,
            Loading, 
            Game,    
            Pause
        }
        GameState gameState;
        public GameClient()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            graphics.PreferredBackBufferHeight = 1080;
            graphics.PreferredBackBufferWidth = 1920;
            this.IsMouseVisible = false;
        }
        protected override void Initialize()
        {
            gameState = GameState.Login;
            spriteBatch = new SpriteBatch(GraphicsDevice);
            base.Initialize();
        }
        protected override void LoadContent()
        {
            cursor = Content.Load<Texture2D>("Cursor");
            cursorPressed = Content.Load<Texture2D>("CursorPressed");
        }
        protected void LoadGame()
        {
        }
        protected override void UnloadContent()
        {
        }
        protected override void Update(GameTime gameTime)
        {
            currentMouseState = Mouse.GetState();
            if (gameState == GameState.Login)
            {
            }
            if (gameState == GameState.Loading)
            {
            }
            if (gameState == GameState.Game)
            {
            }
            if (gameState == GameState.Pause)
            {
            }
            base.Update(gameTime);
            previousMouseState = currentMouseState;
        }
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            if (gameState == GameState.Login)
            {
            }
            if (gameState == GameState.Loading)
            {
            }
            if (gameState == GameState.Game)
            {
            }
            if (gameState == GameState.Pause)
            {
            }
            DrawMouse();
            base.Draw(gameTime);
        }
        private void DrawMouse()
        {
            spriteBatch.Begin();
            if (currentMouseState.LeftButton == ButtonState.Pressed || currentMouseState.RightButton == ButtonState.Pressed)
                spriteBatch.Draw(cursorPressed, new Rectangle(currentMouseState.X, currentMouseState.Y, 43, 50),Color.White);
            else
                spriteBatch.Draw(cursor, new Rectangle(currentMouseState.X, currentMouseState.Y, 43, 50), Color.White);
            spriteBatch.End();
        }
    }
}
